using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter46
{
	/// <summary>
	/// Example01: Checking Baryon Numbers
	/// Use the law of conservation of baryon number 
	/// to determine whether the following reactions can occur:
	/// (A)p+n->p+p+n+\bar{p}
	/// (B)p+n->p+p+\bar{p}
	/// </summary>
	public class Example01
	{
		public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Particle p = new L.Particle();
			p.BaryonNumber = 1;
			L.Particle n = new L.Particle();
			n.BaryonNumber = 1;
			L.Particle barp = new L.Particle();
			barp.BaryonNumber = -1;
            if(p.BaryonNumber+n.BaryonNumber 
				== p.BaryonNumber + p.BaryonNumber 
				+ n.BaryonNumber + barp.BaryonNumber)
			result+="OK\r\n";
			else result+="NO\r\n";	
			if(p.BaryonNumber+n.BaryonNumber 
				== p.BaryonNumber + p.BaryonNumber 
				+ barp.BaryonNumber)
				result+="OK\r\n";
			else result+="NO\r\n";	
		}
	}
}
